import React, { Component } from "react";
// table 组件
import TableComponent from "@c/tableData/Index";
// antd
import { Tag } from "antd";

class NotifyGroupList extends Component {
    constructor(props){
        super(props);
        this.state = {
            // id
            id: "",
            // flag
            flag: false,
            // 请求参数
            PageNumber: 1,
            PageSize: 10,
            keyWork: "",
            // 表头
            tableConfig: {
                url: "notify_recordList",
                method: "get",
                checkbox: true,
                thead: [
                    { title: "提交人", dataIndex: "operator", key: "operator" },
                    { 
                        title: "类型", dataIndex: "send_type", key: "send_type",
                        render: (rowData => {
                            return (
                                <div>
                                    {rowData === 'group' ? '钉钉群' : '工作台'}
                                </div>
                            )
                        })
                    },
                    { title: "内容", dataIndex: "content", key: "content", ellipsis: true },
                    { title: "内容类型", dataIndex: "content_type", key: "content_type" },
                    { 
                        title: "@所有人", dataIndex: "is_at_all", key: "is_at_all",
                        render: (rowData => {
                            return (
                                <div>
                                    <Tag key={rowData}>{rowData.toString()}</Tag>
                                </div>
                            )
                        })
                    },
                    { title: "接收对象", dataIndex: "rec_object", key: "rec_object", ellipsis: true },
                    { title: "备注", dataIndex: "remark", key: "remark" },
                    { title: "结果", dataIndex: "result", key: "result", ellipsis: true }
                ],
                formItem: [
                    { 
                        type: "Input",
                        label: "notify_group", 
                        name: "notify_group", 
                        placeholder: "请输入notify_group"
                    }
                ],
                formSearchCol: 18,
                formRightCol: 6,
            },
            // 表的数据
            data: []
        };
    }
    /** 生命周期挂载完成 */
    componentDidMount(){}

    // 获取子组件实例
    getChildRef = (ref) => {
        this.tableComponent = ref; // 存储子组件
    }
    
    render(){
        return (
            <div>
                <TableComponent onRef={this.getChildRef} batchButton={true} config={this.state.tableConfig}>
                </TableComponent>
            </div>
        )
    }
}
export default NotifyGroupList;